package com.bestcem.xm.deliver.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bestcem.xm.component.mybatis.base.ResultPage;
import com.bestcem.xm.component.mybatis.service.impl.XmServiceImpl;
import com.bestcem.xm.deliver.entity.DeliverSmsTemplate;
import com.bestcem.xm.deliver.mapper.DeliverSmsTemplateMapper;
import com.bestcem.xm.deliver.service.DeliverSmsTemplateService;
import com.bestcem.xm.deliver.util.PageUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * @author been
 * @description 针对表【ds_deliver_smstemplate】的数据库操作Service实现
 * @createDate 2022-11-07 13:49:47
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class DeliverSmsTemplateServiceImpl extends XmServiceImpl<DeliverSmsTemplateMapper, DeliverSmsTemplate>
        implements DeliverSmsTemplateService {

    @Override
    public ResultPage<DeliverSmsTemplate> smsTemplate(Integer page, Integer size) {
        if (Objects.nonNull(page) || Objects.nonNull(size)) {
            page = Objects.nonNull(page) ? page : 1;
            size = Objects.nonNull(size) ? size : 10;
            Page<DeliverSmsTemplate> data = baseMapper.selectPage(new Page<>(page, size), null);
            return PageUtil.getResultPage(data.getCurrent(), data.getTotal(), data.getRecords());
        }
        return null;
    }
}




